﻿@*列表页模板*@
@{
    Layout = null;
    int siteId = int.Parse(Request.RequestContext.RouteData.Values["pageid"].ToString());//获取分页的数字
    var currentSite = new SiteService().GetEntity(siteId);
    var children = new NodeService().GetChildren(3,siteId);
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit" />
    <title>节点列表 - 验收清单 - @currentSite.SiteTitle</title>
    <script src="@Url.AppendVersion("~/Content/_Common/Assets/Scripts/jquery.js")"></script>
</head>
<style>
    /*预置全局样式*/
    a,abbr,acronym,address,applet,article,aside,audio,b,blockquote,big,body,center,canvas,caption,cite,code,command,datalist,dd,del,details,dfn,dl,div,dt,em,embed,fieldset,figcaption,figure,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,keygen,label,legend,meter,nav,object,ol,output,p,pre,progress,q,s,samp,section,small,span,source,strike,strong,sub,sup,menu,tbody,tfoot,thead,th,tr,td,video,tt,u,ul,var{background:transparent;font-size:100%;margin:0;padding:0;border:0;outline:0;}
    body{color:#222;font-size:14px;line-height:1.42857143;font-family:"Microsoft YaHei"}
    a{color:#222;text-decoration:none;}
    a:hover{color:red;}
    a:active{ color:#c30}
    a:visited{ color:#333}
    ol,ul{list-style:none;vertical-align:middle;}
    .check-list{ margin:30px;}
    .check-list .hd{ margin-bottom:20px; text-align:center;}
    .check-list .hd h1.title{ margin-bottom:10px; font-size:30px;}
    .check-list .hd .property{ margin-bottom:10px; text-align:center;}
    .check-list .hd .property span{ padding:0 5px;}
    .btn-group .btn a{display:inline-block; *display:inline; zoom:1;margin:0 5px; padding:4px 10px; background-color:#09f; color:#fff; border-radius:4px}
    .check-list .tips{ text-align:right; font-size:12px; color:#666;}
    .check-list .bd{ margin-bottom:20px; overflow:hidden;}
    .check-list .fd{ clear:both; border-top:1px solid #ddd; padding:20px 0; text-align:center;}
    .check-table{width: 100%; border-top:1px solid #000; border-left:1px solid #000; }
    .check-table tr{ position: relative;}
    .check-table tr.active{ background-color:#eee;}
    .check-table tr:hover{ background-color:#faf9f1;}
    .check-table tr th{ padding:9px; border-bottom:2px solid #000; border-right:1px solid #000; background-color:#dee;}
    .check-table tr td{ border-bottom:1px solid #000; border-right:1px solid #000; padding:5px; font-size: 12px;min-width:70px;word-break: break-all; white-space: pre-wrap;}
    .nodeName,.nodeType,.nodeModel,.archived{ text-align:center;}
    .state{ display:inline-block; *display:inline; zoom:1; margin-right:5px; width: 8px; height:8px;background-color: #aaa; border-radius:50%;}
    .state.red{ background-color:red;}
    .state.green{ background-color:green;}
    #open-url{ position: relative;}
    #open-url .url-num{ display:none; position: absolute; top:24px;left:0;right:0;padding:10px; background-color: #dee; border-radius:4px; box-shadow:1px 3px 8px rgba(0,0,0,.2);}
    #open-url .url-num input{width:20px;border:none; padding:4px;border-radius:4px; text-align:center;}
</style>
<body>
    <div class="check-list">
        <div class="hd">
            <h1 class="title">
                <span>@currentSite.SiteTitle</span>网站验收清单检测目录
            </h1>
            <div class="property">
                <span class="node-num"></span>
                <span class="date">日期：<script>var lastModified = document.lastModified;var lastDate = new Date(lastModified);var gy = lastDate.getFullYear();var gm = lastDate.getMonth()+1;var gd = lastDate.getDate();document.write(gy+"年"+gm+"月"+gd+"日")</script></span>
            </div>
            <div class="btn-group">
                <span id="node-err" class="btn" style="display: none;"><a href="javascript:void(0)" title="仅查看异常节点">异常节点</a></span>
                <span id="open-url" class="btn">
                    <a href="javascript:void(0)" title="打开当前显示所有链接">打开链接</a>
                    <div class="url-num"><input size="3" type="input" class="num-min" placeholder="1">~<input size="3" type="input" class="num-max" placeholder="10"></div>
                </span>
                <span id="reload" class="btn"><a href="javascript:window.location.reload()" title="刷新当前页面">刷新页面</a></span>
                <span id="copy" class="btn" data-clipboard-target="#check-table"><a href="javascript:void(0)" title="去掉表格多余列数据，并复制到剪贴板 &#10;复制后可直接粘贴到项目验收清单中">一键复制</a></span>
            </div>
            <div class="tips">注：在“网站地图”处隐藏的节点不会显示在列表中。</div>
        </div>
        <div class="bd">
            <table class="check-table" id="check-table" border="0" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th class="nodeName">一级节点</th>
                        <th class="nodeName">二级节点</th>
                        <th class="nodeName">三级节点</th>
                        <th class="linkUrl">地址检测</th>
                        <th class="nodeType">节点类型</th>
                        <th class="nodeModel">节点模型</th>
                        <th class="archived">归档</th>
                        <th class="viewPath">首页模板</th>
                        <th class="viewPath">节点模板</th>
                        <th class="viewPath">内容模板</th>
                        <th class="viewPath">单页模板</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var child in children.Where(n => n.ShowOnMap))
                    {
                        var chlidLink ="";
                        if( child.NodeType == NodeType.Link){
                            if(string.IsNullOrEmpty(child.LinkUrl)){
                                chlidLink = "空链接" ;
                            }
                            else if( child.LinkUrl.StartsWith("http") ){
                                chlidLink = "外链接" ;
                            }
                            else if( child.LinkUrl.Contains("SiteUrl:") ){
                                chlidLink = "<a target='_blank' href='"+ child.LinkUrl.ToUrl() +"'>"+ child.LinkUrl.ToUrl() +"</a>";
                            }else{
                                chlidLink = "<a target='_blank' href='"+ Power.Url.SiteUrl(child.Site.Subdomain) + child.LinkUrl.ToUrl() +"'>"+ Power.Url.SiteUrl(child.Site.Subdomain) + child.LinkUrl.ToUrl() +"</a>";
                            }
                        }
                        else{
                            chlidLink = "<a target='_blank' href='"+ Power.Url.SiteUrl(child.Site.Subdomain) + Power.Url.NodeUrl(child) +"'>"+ Power.Url.SiteUrl(child.Site.Subdomain) + Power.Url.NodeUrl(child) +"</a>";
                        }
                        <tr class="tr1" title="站点名称：@currentSite.SiteName &#10;节点ID：@child.NodeId &#10;标识符：@child.Identifier &#10;节点类型：@child.NodeType &#10;节点模型：@child.MoldId &#10;首页模板：@child.ListHomeViewPath &#10;列表模板：@child.ListViewPath &#10;内容模板：@child.ContentViewPath &#10;单页模板：@child.SingleViewPath">
                            <td class="nodeName">@child.NodeName</td>
                            <td class="nodeName"></td>
                            <td class="nodeName"></td>
                            <td class="linkUrl"><span class="state"></span>@Power.ToHtml(chlidLink)</td>
                            <td class="nodeType">@if(child.NodeType==0){<span>内容</span>}else if(child.NodeType==NodeType.Single){<span>单页</span>}else if(child.NodeType==NodeType.Link){<span>链接</span>}else{@child.NodeType}</td>
                            <td class="nodeModel">@if(child.MoldId==1){<span>文章</span>}else if(child.MoldId==2){<span>图片</span>}else if(child.MoldId==3){<span>视频</span>}else if(child.MoldId==4){<span>友情链接</span>}else if(child.MoldId==5){<span>领导信息</span>}else if(child.MoldId==6){<span>报告</span>}else if(child.MoldId==7){<span>政策文件</span>}else if(child.MoldId==8){<span>政策解读</span>}else if(child.MoldId==9){<span>业务知识</span>}else if(child.MoldId==10){<span>公开信息</span>}else if(child.MoldId==11){<span>红头文件</span>}else if(child.MoldId==12){<span>行政处罚案件</span>}else{<span>@child.MoldId</span>}</td>
                            <td class="archived">@if(child.Archived==true){<span>已归档<br>@child.ArchivedTime</span>}</td>
                            <td class="viewPath">@child.ListHomeViewPath</td>
                            <td class="viewPath">@child.ListViewPath</td>
                            <td class="viewPath">@child.ContentViewPath</td>
                            <td class="viewPath">@child.SingleViewPath</td>
                        </tr>
                        foreach (var childDepth1 in child.Children.Where(n => n.ShowOnMap))
                        {
                            var childDepth1Link ="";
                            if( childDepth1.NodeType == NodeType.Link){
                                if(string.IsNullOrEmpty(childDepth1.LinkUrl)){
                                    childDepth1Link = "空链接" ;
                                }
                                else if( childDepth1.LinkUrl.StartsWith("http") ){
                                    childDepth1Link = "外链接";
                                }
                                else if( childDepth1.LinkUrl.Contains("SiteUrl:") ){
                                    childDepth1Link ="<a target='_blank' href='"+ childDepth1.LinkUrl.ToUrl() +"'>"+ childDepth1.LinkUrl.ToUrl() +"</a>";
                                }else{
                                    childDepth1Link ="<a target='_blank' href='"+ Power.Url.SiteUrl(child.Site.Subdomain) + childDepth1.LinkUrl.ToUrl() +"'>"+ Power.Url.SiteUrl(child.Site.Subdomain) + childDepth1.LinkUrl.ToUrl() +"</a>";
                                }
                            }else{
                                childDepth1Link ="<a target='_blank' href='"+ Power.Url.SiteUrl(child.Site.Subdomain) + Power.Url.NodeUrl(childDepth1) +"'>"+ Power.Url.SiteUrl(child.Site.Subdomain) + Power.Url.NodeUrl(childDepth1) +"</a>";
                            }
                            <tr class="tr2" title="站点名称：@currentSite.SiteName &#10;节点ID：@childDepth1.NodeId &#10;标识符：@childDepth1.Identifier &#10;节点类型：@childDepth1.NodeType &#10;节点模型：@childDepth1.MoldId &#10;首页模板：@childDepth1.ListHomeViewPath &#10;列表模板：@childDepth1.ListViewPath &#10;内容模板：@childDepth1.ContentViewPath &#10;单页模板：@childDepth1.SingleViewPath">
                                <td class="nodeName">&nbsp;</td>
                                <td class="nodeName">@childDepth1.NodeName</td>
                                <td class="nodeName"></td>
                                <td class="linkUrl"><span class="state"></span>@Power.ToHtml(childDepth1Link)</td>
                                <td class="nodeType">@if(childDepth1.NodeType==0){<span>内容</span>}else if(childDepth1.NodeType==NodeType.Single){<span>单页</span>}else if(childDepth1.NodeType==NodeType.Link){<span>链接</span>}else{@childDepth1.NodeType}</td>
                                <td class="nodeModel">@if(childDepth1.MoldId==1){<span>文章</span>}else if(childDepth1.MoldId==2){<span>图片</span>}else if(childDepth1.MoldId==3){<span>视频</span>}else if(childDepth1.MoldId==4){<span>友情链接</span>}else if(childDepth1.MoldId==5){<span>领导信息</span>}else if(childDepth1.MoldId==6){<span>报告</span>}else if(childDepth1.MoldId==7){<span>政策文件</span>}else if(childDepth1.MoldId==8){<span>政策解读</span>}else if(childDepth1.MoldId==9){<span>业务知识</span>}else if(childDepth1.MoldId==10){<span>公开信息</span>}else if(childDepth1.MoldId==11){<span>红头文件</span>}else if(childDepth1.MoldId==12){<span>行政处罚案件</span>}else{<span>@childDepth1.MoldId</span>}</td>
                                <td class="archived">@if(childDepth1.Archived==true){<span>已归档<br>@childDepth1.ArchivedTime</span>}</td>
                                <td class="viewPath">@childDepth1.ListHomeViewPath</td>
                                <td class="viewPath">@childDepth1.ListViewPath</td>
                                <td class="viewPath">@childDepth1.ContentViewPath</td>
                                <td class="viewPath">@childDepth1.SingleViewPath</td>
                            </tr>
                            foreach (var childDepth2 in childDepth1.Children.Where(n => n.ShowOnMap))
                            {
                                var childDepth2Link ="";
                                if( childDepth2.NodeType == NodeType.Link){
                                    if(string.IsNullOrEmpty(childDepth2.LinkUrl)){
                                        childDepth2Link = "空链接" ;
                                    }
                                    else if( childDepth2.LinkUrl.StartsWith("http") ){
                                        childDepth2Link = "外链接";
                                    }
                                    else if( childDepth2.LinkUrl.Contains("SiteUrl:") ){
                                        childDepth2Link ="<a target='_blank' href='"+ childDepth2.LinkUrl.ToUrl() +"'>"+ childDepth2.LinkUrl.ToUrl() +"</a>";
                                    }else{
                                        childDepth2Link ="<a target='_blank' href='"+ Power.Url.SiteUrl(child.Site.Subdomain) + childDepth2.LinkUrl.ToUrl() +"'>"+ Power.Url.SiteUrl(child.Site.Subdomain) + childDepth2.LinkUrl.ToUrl() +"</a>";
                                    }
                                }else{
                                    childDepth2Link ="<a target='_blank' href='"+ Power.Url.SiteUrl(child.Site.Subdomain) + Power.Url.NodeUrl(childDepth2) +"'>"+ Power.Url.SiteUrl(child.Site.Subdomain) + Power.Url.NodeUrl(childDepth2) +"</a>";
                                }
                                <tr class="tr3" title="站点名称：@currentSite.SiteName &#10;节点ID：@childDepth2.NodeId &#10;标识符：@childDepth2.Identifier &#10;节点类型：@childDepth2.NodeType &#10;节点模型：@childDepth2.MoldId &#10;首页模板：@childDepth2.ListHomeViewPath &#10;列表模板：@childDepth2.ListViewPath &#10;内容模板：@childDepth2.ContentViewPath &#10;单页模板：@childDepth2.SingleViewPath">
                                    <td class="nodeName">&nbsp;</td>
                                    <td class="nodeName">&nbsp;</td>
                                    <td class="nodeName">@childDepth2.NodeName</td>
                                    <td class="linkUrl"><span class="state"></span>@Power.ToHtml(childDepth2Link)</td>
                                    <td class="nodeType">@if(childDepth2.NodeType==0){<span>内容</span>}else if(childDepth2.NodeType==NodeType.Single){<span>单页</span>}else if(childDepth2.NodeType==NodeType.Link){<span>链接</span>}else{@childDepth2.NodeType}</td>
                                    <td class="nodeModel">@if(childDepth2.MoldId==1){<span>文章</span>}else if(childDepth2.MoldId==2){<span>图片</span>}else if(childDepth2.MoldId==3){<span>视频</span>}else if(childDepth2.MoldId==4){<span>友情链接</span>}else if(childDepth2.MoldId==5){<span>领导信息</span>}else if(childDepth2.MoldId==6){<span>报告</span>}else if(childDepth2.MoldId==7){<span>政策文件</span>}else if(childDepth2.MoldId==8){<span>政策解读</span>}else if(childDepth2.MoldId==9){<span>业务知识</span>}else if(childDepth2.MoldId==10){<span>公开信息</span>}else if(childDepth2.MoldId==11){<span>红头文件</span>}else if(childDepth2.MoldId==12){<span>行政处罚案件</span>}else{<span>@childDepth2.MoldId</span>}</td>
                                    <td class="archived">@if(childDepth2.Archived==true){<span>已归档<br>@childDepth2.ArchivedTime</span>}</td>
                                    <td class="viewPath">@childDepth2.ListHomeViewPath</td>
                                    <td class="viewPath">@childDepth2.ListViewPath</td>
                                    <td class="viewPath">@childDepth2.ContentViewPath</td>
                                    <td class="viewPath">@childDepth2.SingleViewPath</td>
                                </tr>
                            }
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    $(".property .node-num").append('检测节点：正常<num class="ok">0</num>, 异常<num class="err">0</num>, 外链<num class="no">0</num>, 共计<b>0</b>个');
    $(".property .node-num b").html($(".check-table tbody tr").length);//统计tr数量
    $(".check-table .linkUrl a").click(function(){
        $(this).parent().parent().addClass("active");//鼠标触发背景
    });
    //加载完成后，批量判断URL状态，并统计数量
    $(function() {
        $(".check-table tbody tr").each (function (i){
            var nodeUrl = $(this).find("a").text();
            if(nodeUrl != ''){
                $.ajax({
                    url: nodeUrl,
                    statusCode: {
                        404: function() {
                            $(".check-table tbody tr").eq(i).find(".state").addClass("red");
                            $('.node-num .err').html(parseInt($('.node-num .err').text()) + 1);
                            $("#node-err").show();
                        },
                        200: function() {
                            $(".check-table tbody tr").eq(i).find(".state").addClass("green");
                            $('.node-num .ok').html(parseInt($('.node-num .ok').text()) + 1);
                        }
                    }
                });
            } else if (nodeUrl = "外链接" ){
                $('.node-num .no').html(parseInt($('.node-num .no').text()) + 1);
            }
        });
    },1000);
    // 仅查看异常节点
    $("#node-err a").click(function(){
        $(".check-table tbody tr").each (function (){
            if(!$(this).find(".state").hasClass("red")){
                $(this).remove();   
            }
        })
    });
    //鼠标经过显示输入框
    $("#open-url").hover(function() {
        var osd = $("#open-url .url-num");
        if (osd.is(":visible")) {osd.slideUp("fast");} else {osd.slideDown("fast");}
    });
    // 批量打开站点链接
    $("#open-url a").click(function(){
        var openUrl ='';
        var trLength =$(".check-table tbody tr").length;
        var numMin =$(".num-min").val() - 1;
        if (numMin < 0 || numMin =='') {
            numMin = 0;
        }
        var numMax =$(".num-max").val();
        if (numMax < 0 || numMax =='') {
            numMax = 0;
        } else if(numMax > trLength){
            numMax = trLength;
        }
        if (numMax > 0) {
            for (var i = numMin; i < numMax; i++) {
                openUrl += window.open($(".check-table tbody tr td.linkUrl").eq(i).find("a").attr("href"));
            }
        } else {
            for (var i = 0; i < trLength; i++) {
                openUrl += window.open($(".check-table tbody tr td.linkUrl").eq(i).find("a").attr("href"));
            }
        }
    });
    // 简化表格并复制表格
    $("#copy").click(function(){
        $(".check-table tr").each (function (){
            $(this).find(".nodeType,.nodeModel,.viewPath,.archived,.state").remove();
        });
        //复制粘贴
        !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(r)return r(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n?n:t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(t,e,n){var o=t("matches-selector");e.exports=function(t,e,n){for(var i=n?t:t.parentNode;i&&i!==document;){if(o(i,e))return i;i=i.parentNode}}},{"matches-selector":5}],2:[function(t,e,n){function o(t,e,n,o,r){var a=i.apply(this,arguments);return t.addEventListener(n,a,r),{destroy:function(){t.removeEventListener(n,a,r)}}}function i(t,e,n,o){return function(n){n.delegateTarget=r(n.target,e,!0),n.delegateTarget&&o.call(t,n)}}var r=t("closest");e.exports=o},{closest:1}],3:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},{}],4:[function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return i(t,e,n);if(c.nodeList(t))return r(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return s(document.body,t,e,n)}var c=t("./is"),s=t("delegate");e.exports=o},{"./is":3,delegate:2}],5:[function(t,e,n){function o(t,e){if(r)return r.call(t,e);for(var n=t.parentNode.querySelectorAll(e),o=0;o<n.length;++o)if(n[o]==t)return!0;return!1}var i=Element.prototype,r=i.matchesSelector||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector;e.exports=o},{}],6:[function(t,e,n){function o(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),o=document.createRange();o.selectNodeContents(t),n.removeAllRanges(),n.addRange(o),e=n.toString()}return e}e.exports=o},{}],7:[function(t,e,n){function o(){}o.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){i.off(t,o),e.apply(n,arguments)}var i=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;for(o;i>o;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,a=o.length;a>r;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if("undefined"!=typeof o)r(n,e("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),c=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},t.prototype.initSelection=function t(){this.text?this.selectFake():this.target&&this.selectTarget()},t.prototype.selectFake=function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()},t.prototype.removeFake=function t(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function t(){this.selectedText=(0,i.default)(this.target),this.copyText()},t.prototype.copyText=function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(n){e=!1}this.handleResult(e)},t.prototype.handleResult=function t(e){e?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function t(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function t(){this.removeFake()},a(t,[{key:"action",set:function t(){var e=arguments.length<=0||void 0===arguments[0]?"copy":arguments[0];if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==("undefined"==typeof e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:6}],9:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var l=i(e),u=i(n),f=i(o),d=function(t){function e(n,o){r(this,e);var i=a(this,t.call(this));return i.resolveOptions(o),i.listenClick(n),i}return c(e,t),e.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},e.prototype.listenClick=function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})},e.prototype.onClick=function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})},e.prototype.defaultAction=function t(e){return s("action",e)},e.prototype.defaultTarget=function t(e){var n=s("target",e);return n?document.querySelector(n):void 0},e.prototype.defaultText=function t(e){return s("text",e)},e.prototype.destroy=function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},e}(u.default);t.exports=d})},{"./clipboard-action":8,"good-listener":4,"tiny-emitter":7}]},{},[9])(9)});
        //复制粘贴-配置
        var clipboard = new Clipboard('#copy');
        clipboard.on('success', function(e) {
            alert("节点列表已复制，可粘贴到《实施中心项目验收表格》中。", 1500);
            e.clearSelection();
            console.log(e.clearSelection);
        });
        clipboard.on('error', function(e) {
            alert('复制失败');
            e.clearSelection();
            console.log(e.clearSelection);
        });
    });
</script>